package vista;
import java.awt.event.ActionListener;
import java.util.Vector;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTable;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class frmlistadodeventas extends javax.swing.JFrame {
	private JLabel lblordenado;
	private JLabel lbllistadosdeventas;
	private JSeparator sp;
	private JButton btnsalir;
	private JScrollPane sclistadodeventasdeproductos;
	private JComboBox cmbordenado;
	private JTable detalleListado;
	private frmListadoVentasModeloTabla modelo;
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				frmlistadodeventas inst = new frmlistadodeventas();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public frmlistadodeventas() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Listado de Ventas de Productos Ordenados");
			getContentPane().setLayout(null);
			{
				lblordenado = new JLabel();
				getContentPane().add(lblordenado);
				lblordenado.setText("Ordenado :");
				lblordenado.setBounds(48, 41, 59, 16);
			}
			{
				ComboBoxModel cmbordenadoModel = 
					new DefaultComboBoxModel(
							new String[] { "Item One", "Item Two" });
				cmbordenado = new JComboBox();
				getContentPane().add(cmbordenado);
				cmbordenado.setModel(cmbordenadoModel);
				cmbordenado.setBounds(135, 41, 139, 23);
			}
			{
				sclistadodeventasdeproductos = new JScrollPane();
				getContentPane().add(sclistadodeventasdeproductos);
				sclistadodeventasdeproductos.setBounds(18, 107, 479, 164);
				{
					detalleListado = new JTable();
					sclistadodeventasdeproductos.setViewportView(detalleListado);
					modelo = new frmListadoVentasModeloTabla();
					detalleListado.setModel(modelo);
				}
			}
			{
				btnsalir = new JButton();
				getContentPane().add(btnsalir);
				btnsalir.setText("Salir");
				btnsalir.setBounds(417, 316, 65, 23);
			}
			{
				sp = new JSeparator();
				getContentPane().add(sp);
				sp.setBounds(-25, 297, 544, 10);
			}
			{
				lbllistadosdeventas = new JLabel();
				getContentPane().add(lbllistadosdeventas);
				lbllistadosdeventas.setText("Listado de Ventas de Productos Ordenados");
				lbllistadosdeventas.setBounds(135, 13, 236, 16);
				lbllistadosdeventas.setFont(new java.awt.Font("Segoe UI",1,12));
			}
			pack();
			this.setSize(525, 399);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	public void addListener(ActionListener actionListener) {
		cmbordenado.addActionListener(actionListener);
		btnsalir.addActionListener(actionListener);
}
	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public String getcategoria(){
		return cmbordenado.getSelectedItem().toString();
	}
	public frmListadoVentasModeloTabla getModelo()
	{
		return modelo;
	}
	public void setResultados(AbstractTableModel abstractTableModel) {
		detalleListado.setModel(abstractTableModel);
	}
}
